#!/bin/bash

pip install --upgrade pip setuptools wheel

tar -czf huaweicloud-sdk-python-src.tar.gz $(find . -maxdepth 1 -mindepth 1  | egrep -v ".cid|.git|.codecheck|buildscript|*.sh")

for each in $(find "$CID_WORKSPACE" -maxdepth 1 -mindepth 1 -type d -name "*sdk*")
do
  cd "$each" || exit 1
  python setup.py bdist_wheel
  cp dist/*.whl "$CID_WORKSPACE"
done

cd "$CID_WORKSPACE" || exit 1
tar -czf huaweicloud-sdk-python-bin.tar.gz ./*.whl

tar -czf huaweicloud-sdk-python-release."$(cat VERSION).${CID_BUILD_TIME}.${CID_BUILD_NUMBER}".tar.gz huaweicloud-sdk-python-src.tar.gz huaweicloud-sdk-python-bin.tar.gz
